package com.gitee.feizns.webtemplate.commons.wechat.boot;

import com.gitee.feizns.webtemplate.commons.wechat.WeChatProperties;
import com.gitee.feizns.webtemplate.commons.wechat.WeChatService;
import com.gitee.feizns.webtemplate.commons.wechat.impl.WeChatServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @author feizns
 * @since 2019/5/16
 */
@ConditionalOnBean(RestTemplate.class)

@Configuration
//@EnableConfigurationProperties(WeChatProperties.class)
public class WeChatAutoConfiguration {


//    @ConditionalOnProperty(prefix = "we-chat.config")
//    @ConfigurationProperties("we-chat.config")
//    @Bean
//    public WeChatProperties weChatProperties() {
//        return new WeChatProperties();
//    }
//
//    @Autowired
//    private RestTemplate restTemplate;
//
//    @ConditionalOnBean(WeChatProperties.class)
//    @Bean
//    public WeChatService weChatService(WeChatProperties properties) {
//        return new WeChatServiceImpl(properties, restTemplate);
//    }

}
